package org.cyb.demo.service.impl;

import org.cyb.demo.dao.*;
import org.cyb.demo.domain.*;
import org.cyb.demo.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("courseService")
public class CourseServiceImpl implements CourseService {

    @Autowired
    private CourseMapper courseMapper;
    @Autowired
    private MajorMapper majorMapper;
    @Autowired
    private PptMapper pptMapper;
    @Autowired
    private VideoMapper videoMapper;
    @Autowired
    private ChapterMapper chapterMapper;

    @Override
    public List<Course> getByMajorName(Major major) {
        return courseMapper.selectByMajorName(major);
    }

    @Override
    public List<Course> getByCourseName(Course course) {
        return courseMapper.selectByCourseName(course);
    }

    @Override
    public List<Course> getAll() {
        return courseMapper.selectAll();
    }

    @Override
    public Course getOneByName(Course course) {
        return courseMapper.selectOneByName(course);
    }

    @Override
    public Course getOneById(Course course) {
        return courseMapper.selectOneById(course);
    }

    @Override
    public void delete(Course course) {
        courseMapper.delete(course);
    }

    @Override
    public void add(Course course,Major major) {
        courseMapper.insert(course,major);
    }
}
